<template>
  <div class="editCont">
    <div class="edt2" @click="back">
      <img
        style="width: 29px; height: 25px; opacity: 0.5; cursor: pointer"
        src="../../assets/back.png"
      />
      <span>返回</span>
    </div>
    <div class="edt1">
      <!--  <el-button type="primary" @click="preview">查看认证证书</el-button>
      <el-image-viewer
        v-if="detailVisible"
        :url-list="imgList"
        :on-close="closeFunc"
      /> -->
      <!-- <el-button type="primary" plain @click="savebase">保存</el-button> -->
    </div>
    <div class="hx"></div>
    <div class="contss">
      <div>
        <span class="jx"><span style="margin-left: 10px">基本信息</span></span>
      </div>
      <div class="fmor">
        <el-form
          :model="infoss"
          ref="basicForm"
          size="mini"
          label-width="150px"
          label-position="right"
          :rules="rules"
        >
          <el-row>
            <el-col :span="8">
              <el-form-item label="企业名称:" prop="name">
                <el-input v-model="infoss.name" placeholder="请输入"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="统一社会信用代码:" prop="creditCode">
                <el-input
                  v-model="infoss.creditCode"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="中证码:" prop="middleSignCode">
                <el-input
                  v-model="infoss.middleSignCode"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="所属地区:" prop="area">
                <el-input v-model="infoss.area" placeholder="请输入"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="类型:" prop="type">
                <el-input v-model="infoss.type" placeholder="请输入"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="企业所有制:" prop="enterpriseOwnership">
                <el-input
                  v-model="infoss.enterpriseOwnership"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="注册资本:" prop="registerCapital">
                <el-input
                  v-model="infoss.registerCapital"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="营业收入:" prop="businessIncome">
                <el-input
                  v-model="infoss.businessIncome"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="行业分类:" prop="industryClassification">
                <el-input
                  v-model="infoss.industryClassification"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="资产总数:" prop="totalAssets">
                <el-input
                  v-model="infoss.totalAssets"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="从业人数:" prop="employeeNumber">
                <el-input
                  v-model="infoss.employeeNumber"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="规模:">
                <el-select
                  v-model="infoss.scale"
                  placeholder="请输入"
                  style="width: 217px"
                >
                  <el-option label="" value=""></el-option>
                  <el-option label="大" value="0"></el-option>
                  <el-option label="小" value="1"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="是否涉及农业:">
                <el-select
                  v-model="infoss.isInvolveAgriculture"
                  placeholder="请输入"
                  style="width: 217px"
                >
                  <el-option label="" value=""></el-option>
                  <el-option label="是" value="0"></el-option>
                  <el-option label="否" value="1"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="是否绿色农业:">
                <el-select
                  v-model="infoss.isGreenEnterprise"
                  placeholder="请输入"
                  style="width: 217px"
                >
                  <el-option label="" value=""></el-option>
                  <el-option label="是" value="0"></el-option>
                  <el-option label="否" value="1"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="是否科技企业:">
                <el-select
                  v-model="infoss.isTechnologyEnterprise"
                  placeholder="请输入"
                  style="width: 217px"
                >
                  <el-option label="" value=""></el-option>
                  <el-option label="是" value="0"></el-option>
                  <el-option label="否" value="1"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="是否民营企业:">
                <el-select
                  v-model="infoss.isNongovernmentalEnterpise"
                  placeholder="请输入"
                  style="width: 217px"
                >
                  <el-option label="" value=""></el-option>
                  <el-option label="是" value="0"></el-option>
                  <el-option label="否" value="1"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="营业期限开始日期:">
                <el-date-picker
                  v-model="infoss.businessStartTime"
                  type="date"
                  placeholder="选择日期"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="营业期限结束日期:">
                <el-date-picker
                  v-model="infoss.businessEndTime"
                  type="date"
                  placeholder="选择日期"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="经营范围:">
                <el-select
                  v-model="infoss.businessScope"
                  placeholder="请输入"
                  style="width: 217px"
                >
                  <el-option label="" value=""></el-option>
                  <el-option label="大" value="0"></el-option>
                  <el-option label="小" value="1"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <div class="xtrz"></div>
        <div>
          <span class="jx2"><span style="margin-left: 10px">经办人</span></span>
        </div>
        <el-form
          :model="infoss"
          ref="levelForm"
          size="mini"
          label-width="150px"
          label-position="right"
          :rules="rules"
        >
          <el-row>
            <el-col :span="8">
              <el-form-item label="姓名:" prop="agentName">
                <el-input
                  v-model="infoss.agentName"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="居民身份证号码:"
                prop="agentIdentificationNumber"
              >
                <el-input
                  v-model="infoss.agentIdentificationNumber"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="联系电话:" prop="agentPhone">
                <el-input
                  v-model="infoss.agentPhone"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="电子邮箱:" prop="agentEmail">
                <el-input
                  v-model="infoss.agentEmail"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <div class="xtrz"></div>
        <div>
          <span class="jx2"
            ><span style="margin-left: 10px">法人信息</span></span
          >
        </div>
        <el-form
          :model="infoss"
          ref="MoreForm"
          size="mini"
          label-width="150px"
          label-position="right"
          :rules="rules"
        >
          <el-row>
            <el-col :span="8">
              <el-form-item label="姓名:" prop="corporationName">
                <el-input
                  v-model="infoss.corporationName"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="国籍:" prop="corporationNationality">
                <el-input
                  v-model="infoss.corporationNationality"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="证件类型:" prop="credentialsType">
                <el-input
                  v-model="infoss.credentialsType"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="证件号码:" prop="credentialsNumber">
                <el-input
                  v-model="infoss.credentialsNumber"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="证件签发日:" prop="credentialsSignTime">
                <el-date-picker
                  v-model="infoss.credentialsSignTime"
                  type="date"
                  placeholder="请选择日期"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="证件到期日:" prop="credentialsExpireTime">
                <el-date-picker
                  v-model="infoss.credentialsExpireTime"
                  type="date"
                  placeholder="请选择日期"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="证件签发城市:" prop="credentialsSignCity">
                <el-input
                  v-model="infoss.credentialsSignCity"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div style="text-align: center;width: 795px;" @click="baseSim()">
        <el-button type="primary">下一步</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import ElImageViewer from "element-ui/packages/image/src/image-viewer";
import { editWorks, getUploadInfo, baseSimm } from "@/api/leagues/app";
export default {
  name: "",
  components: {
    ElImageViewer,
  },
  data() {
    return {
      detailVisible: false,
      billInfo: {},
      transInfo: {},
      infoss: {},
      rules: {
        name: [{ required: true, message: "请输入企业名称", trigger: "blur" }],
        creditCode: [
          {
            required: true,
            message: "请输入统一社会信用代码",
            trigger: "blur",
          },
        ],
        middleSignCode: [
          {
            required: true,
            message: "请输入中证码",
            trigger: "blur",
          },
        ],
        area: [
          {
            required: true,
            message: "请输入所属地区",
            trigger: "blur",
          },
        ],
        type: [
          {
            required: true,
            message: "请输入类型",
            trigger: "blur",
          },
        ],
        enterpriseOwnership: [
          {
            required: true,
            message: "请输入企业所有制",
            trigger: "blur",
          },
        ],
        registerCapital: [
          {
            required: true,
            message: "请输入注册资本",
            trigger: "blur",
          },
        ],
        businessIncome: [
          {
            required: true,
            message: "请输入营业收入",
            trigger: "blur",
          },
        ],
        industryClassification: [
          {
            required: true,
            message: "请输入行业分类",
            trigger: "blur",
          },
        ],
        totalAssets: [
          {
            required: true,
            message: "请输入资产总额",
            trigger: "blur",
          },
        ],
        employeeNumber: [
          {
            required: true,
            message: "请输入从业人数",
            trigger: "blur",
          },
        ],
        agentName: [
          {
            required: true,
            message: "请输入姓名",
            trigger: "blur",
          },
        ],
        agentIdentificationNumber: [
          {
            required: true,
            message: "请输入居民身份证号码",
            trigger: "blur",
          },
        ],
        agentPhone: [
          {
            required: true,
            message: "请输入联系电话",
            trigger: "blur",
          },
        ],
        agentEmail: [
          {
            required: true,
            message: "请输入电子邮件",
            trigger: "blur",
          },
        ],
        corporationName: [
          {
            required: true,
            message: "请输入姓名",
            trigger: "blur",
          },
        ],
        corporationNationality: [
          {
            required: true,
            message: "请输入国籍",
            trigger: "blur",
          },
        ],
        credentialsType: [
          {
            required: true,
            message: "请输入证件类型",
            trigger: "blur",
          },
        ],
        credentialsNumber: [
          {
            required: true,
            message: "请输入证件号码",
            trigger: "blur",
          },
        ],
        credentialsSignTime: [
          {
            required: true,
            message: "请输入证件签发日",
            trigger: "blur",
          },
        ],
        credentialsExpireTime: [
          {
            required: true,
            message: "请输入证件到期日",
            trigger: "blur",
          },
        ],
        credentialsSignCity: [
          {
            required: true,
            message: "请输入证件签发城市",
            trigger: "blur",
          },
        ],
        phone: [
          {
            required: true,
            message: "请输入手机号码",
            trigger: "blur",
          },
        ],
        code: [
          {
            required: true,
            message: "请输入验证码",
            trigger: "blur",
          },
        ],
      },
    };
  },
  //方法集合
  created() {
    this.getUploadInfos();
  },
  methods: {
    back() {
      this.$router.go(-1);
    },
    //照片
    getUploadInfos() {
      var that = this;
      getUploadInfo()
        .then((data) => {
          this.infoss = data.data.data;
          that.$message.success(data.data.msg);
        })
        .catch((error) => {
          console.log(error);
        });
    },
    baseSim() {
      Promise.all([
        this.$refs.basicForm.validate(),
        this.$refs.levelForm.validate(),
        this.$refs.MoreForm.validate(),
      ]).then((res) => {
        const validateResult = res.every((item) => !!item);
        if (validateResult) {
          console.log("表单都校验通过");
          // this.infoss.step = this.active;
          baseSimm(this.infoss).then((data) => {
            let code = data.data.data.step;
            this.$router.push({
              path: "user",
              query: { code: code },
            });

            //  this.$message.success(data.data.msg);
            // this.next();
          });
        } else {
          this.saveLoading = false;
          console.log("表单未校验通过");
        }
      });
    },
  },
};
</script>
<style  scoped>
.edt2 {
  float: left;
  height: 24px;
  font-size: 25px;
  font-weight: bold;
  color: #051232;
  line-height: 54px;
  margin-left: 10px;
}
.edt1 {
  height: 24px;
  font-size: 25px;
  font-weight: bold;
  color: #051232;
  line-height: 54px;
  float: right;
  margin-right: 11px;
}
.jx {
  width: 2px;
  height: 20px;
  font-size: 18px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #051232;
  line-height: 100px;
  text-indent: 20px;
  border-left: 3px solid #0075ff;
  margin-left: 40px;
}
.jx2 {
  width: 2px;
  height: 20px;
  font-size: 18px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #051232;
  line-height: 100px;
  text-indent: 20px;
  border-left: 3px solid #0075ff;
  margin-left: -47px;
}
.pj {
  height: 84px;
  background: rgba(255, 255, 255, 0);
  box-shadow: 0px 1px 0px 0px #e6e6e6;
  display: flex;
  margin-left: 94px;
}
.fmor {
  position: relative;
  margin-left: 93px;
}
.editCont {
  width: 1200px;
  height: 1300px;
  background: #ffffff;
  box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, 0.06);
  border-radius: 6px 6px 10px 10px;
  margin: 0 auto;
  position: relative;
  top: 50%;
}
.hx {
  width: 1200px;
  height: 54px;
  background: rgba(255, 255, 255, 0);
  box-shadow: 0px 1px 0px 0px #e6e6e6;
}
.hx2 {
  width: 1200px;
  height: 54px;
  background: rgba(255, 255, 255, 0);
  box-shadow: 0px 1px 0px 0px #e6e6e6;
  margin-top: 181px;
}
.lzp {
  margin-left: 10px;
}
.sx {
  width: 2px;
  height: 20px;
  background: #0075ff;
}
.sxzt {
  height: 17px;
  font-size: 18px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #051232;
  line-height: 10px;
  margin-left: 10px;
  margin-top: 5px;
}
.tag {
  width: 63px;
  height: 26px;
  border: 2px solid #15be6b;
  position: relative;
  background-color: #15be6b;
  margin-left: 119px;
  margin-top: -52px;
}
.tag:before,
.tag:after {
  content: "";
  display: block;
  border-width: 7px;
  position: absolute;
  bottom: -16px;
  left: -1px;
  border-style: solid dashed dashed;
  border-color: #15be6b transparent transparent;
  font-size: 0;
  line-height: 0;
}
/* .tag:after {
  bottom: -33px;
  border-color: #fff transparent transparent;
} */
.tag span {
  width: 35px;
  height: 12px;
  font-size: 12px;
  font-weight: 400;
  color: #ffffff;
  line-height: 23px;
  padding-left: 7px;
}
.lfwz {
  height: 14px;
  font-size: 14px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #586279;
  line-height: 36px;
  margin-top: 57px;
  margin-left: 85px;
}
.lfwzsp {
  display: inline-block;
  width: 80px;
  text-align: right;
}

.rgftu {
  float: right;
  display: inline-flex;
  margin-right: 225px;
  margin-top: -19px;
}
.jywz {
  height: 13px;
  font-size: 14px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #586279;
  line-height: 56px;
  margin-left: 70px;
}
.jycts {
  display: flex;
  margin-top: 13px;
}
</style>
